import { SYSTEM_CONFIG } from "../config/system"
import { ElNotification, ElMessage } from 'element-plus'
import { BuildPropType } from "element-plus/es/utils/props"

export function messageTip(title: string, message: string, type: BuildPropType<StringConstructor, "info" | "success" | "warning" | "error", unknown> | undefined) {
    if (SYSTEM_CONFIG.messageInfo === 'elMessage') {
        ElMessage({
            message,
            type
        })
    } else if (SYSTEM_CONFIG.messageInfo === 'elNotification') {
        ElNotification({
            title,
            message,
            type,
        })
    }
}
export function messageSuccessTip(message: string) {
    messageTip("成功", message, 'success')
}

export function messageWarningTip(message: string) {
    messageTip("注意", message, 'warning')
}

export function messageErrorTip(message: string) {
    messageTip("错误", message, 'error')
}

export function messageInfoTip(message: string) {
    messageTip("提示", message, 'info')
}